#!/usr/bin/env python3
# -*- coding: utf-8 -*-
' main entry '
__author__ = 'pingwu you'

def help_demo():
    from collections import namedtuple
    Point = namedtuple('Point', ['x', 'y'])
    p = Point(1, 2)
    print(p)

    Circle = namedtuple('Circle', ['x', 'y', 'r'])
    c=Circle(10,20,0.3)
    print(c)

    #双向链表
    from collections import deque
    q = deque(['a', 'b', 'c'])
    q.append('x')
    q.appendleft('y')
    print(q)
    print(q.pop())
    print(q.popleft())

    #dict 默认无序
    d = dict([('a', 1), ('c', 3), ('b', 2)])
    print(d)
    #注意，OrderedDict的Key会按照插入的顺序排列，不是Key本身排序：
    from collections import OrderedDict
    od = OrderedDict([('a', 1), ('c', 3), ('b', 2)])
    print(od)